package io.renren.modules.app.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.app.entity.BsRegisgooutEntity;
import io.renren.modules.app.service.BsRegisgooutService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;





/**
 * 外出登记表
 *
 */
@RestController
@RequestMapping("tb_bs_regisgoout/bsregisgoout")
public class BsRegisgooutController {
    @Autowired
    private BsRegisgooutService bsRegisgooutService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("tb_bs_regisgoout:bsregisgoout:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bsRegisgooutService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("tb_bs_regisgoout:bsregisgoout:info")
    public R info(@PathVariable("id") Long id){
		BsRegisgooutEntity bsRegisgoout = bsRegisgooutService.getById(id);

        return R.ok().put("bsRegisgoout", bsRegisgoout);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("tb_bs_regisgoout:bsregisgoout:save")
    public R save(@RequestBody BsRegisgooutEntity bsRegisgoout){
        bsRegisgooutService.saveRegis(bsRegisgoout);
		//bsRegisgooutService.save(bsRegisgoout);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("tb_bs_regisgoout:bsregisgoout:update")
    public R update(@RequestBody BsRegisgooutEntity bsRegisgoout){
        bsRegisgooutService.updateRegisById(bsRegisgoout);
		//bsRegisgooutService.updateById(bsRegisgoout);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("tb_bs_regisgoout:bsregisgoout:delete")
    public R delete(@RequestBody Long[] ids){
		bsRegisgooutService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
